#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'UTP是不可靠的连接，但是相比于TCP速度快'

import socket

s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)

for data in [b'Michael', b'Tracy', b'Sarah']:
    # 发送数据
    s.sendto(data,('127.0.0.1',9999))
    # 接收数据
    data,addr = s.recvfrom(1024)
    print(addr,data.decode('utf-8'))
s.close()